<template>
    <div class="main-container">
      <!-- 动态背景 -->
      <div class="animated-background"></div>
  
      <!-- 主内容区 -->
      <div class="content-wrapper">
        <!-- 身份选择卡片 -->
        <div class="card-group">
          <router-link to="/stuLogin" class="card">
            <transition name="card-enter" appear>
            <el-card 
              class="identity-card student-card"
              shadow="hover"
              @mouseenter="hoverIndex = 0"
              @mouseleave="hoverIndex = -1"
              :style="cardStyle(0)"
            >
              <div class="card-content">
                <i class="el-icon-user"></i>
                <h2>我是学生</h2>
                <p class="sub-text">开启编程学习之旅</p>
              </div>
            </el-card>
          </transition>
          </router-link>
  
          <router-link to="/login" class="card">
            <transition name="card-enter" appear>
            <el-card 
              class="identity-card admin-card"
              shadow="hover"
              @mouseenter="hoverIndex = 1"
              @mouseleave="hoverIndex = -1"
              :style="cardStyle(1)"
            >
              <div class="card-content">
                <i class="el-icon-s-tools"></i>
                <h2>我是管理员</h2>
                <p class="sub-text">进入系统管理后台</p>
              </div>
            </el-card>
          </transition>
          </router-link>
        </div>
  
        <!-- 计算机寄语 -->
        <div class="inspiration-section">
          <h3 class="quote-title">💻 致数字世界的探索者：</h3>
          <p class="animated-quote">
            "代码是<span class="highlight">现代诗</span>，算法是<span class="highlight">逻辑的乐章</span><br>
            在<span class="gradient-text">0和1</span>的宇宙中，每个字符都承载着创新的力量<br>
            愿你既能用<span class="code-style">printf("Hello World");</span>开启旅程<br>
            也能以<span class="algorithm-style">while(!succeed){ try(); }</span>的精神突破边界<br>
            🌌 这里是梦想的键盘，敲击出属于你的星辰大海 🚀"
          </p>
        </div>
      </div>
    </div>
  </template>
  
  <script setup>
  import { ref, computed } from 'vue'
  
  const hoverIndex = ref(-1)
  
  // 动态卡片样式
  const cardStyle = (index) => computed(() => ({
    transform: hoverIndex.value === index ? 
      'translateY(-10px) scale(1.05)' : 
      'translateY(0) scale(1)',
    background: hoverIndex.value === index ?
      'linear-gradient(135deg, rgba(255,255,255,0.95), rgba(245,247,250,0.95))' :
      'rgba(255,255,255,0.9)',
    transition: 'all 0.3s cubic-bezier(0.4, 0, 0.2, 1)'
  }))
  </script>
  
  <style scoped>
  .main-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #f0f2f5 0%, #e6e9ef 100%);
    position: relative;
    overflow: hidden;
  }
  .card{
    text-decoration: none;
  }
  .animated-background {
    position: absolute;
    top: -50%;
    left: -50%;
    right: -50%;
    bottom: -50%;
    background: linear-gradient(
      45deg,
      rgba(64,158,255,0.05) 25%,
      transparent 25%,
      transparent 75%,
      rgba(64,158,255,0.05) 75%,
      rgba(64,158,255,0.05)
    ), 
    linear-gradient(
      45deg,
      rgba(64,158,255,0.05) 25%,
      transparent 25%,
      transparent 75%,
      rgba(64,158,255,0.05) 75%,
      rgba(64,158,255,0.05)
    );
    background-size: 60px 60px;
    animation: backgroundFlow 20s linear infinite;
  }
  
  @keyframes backgroundFlow {
    0% { transform: translate(0,0); }
    100% { transform: translate(60px, 60px); }
  }
  
  .content-wrapper {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    text-align: center;
  }
  
  .dynamic-title {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 3rem;
    animation: titleGlow 2s ease-in-out infinite alternate;
  }
  
  @keyframes titleGlow {
    from { text-shadow: 0 0 10px rgba(64,158,255,0.2); }
    to { text-shadow: 0 0 20px rgba(64,158,255,0.4); }
  }
  
  .card-group {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 4rem;
  }
  
  .identity-card {
    width: 320px;
    height: 200px;
    border-radius: 15px;
    cursor: pointer;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.3);
    
    .card-content {
      padding: 2rem;
      
      i {
        font-size: 3rem;
        margin-bottom: 1rem;
      }
      
      h2 {
        color: #303133;
        margin-bottom: 0.5rem;
      }
      
      .sub-text {
        color: #606266;
        font-size: 0.95rem;
      }
    }
  }
  
  .student-card {
    .el-icon-user {
      color: #409EFF;
      animation: iconFloat 3s ease-in-out infinite;
    }
  }
  
  .admin-card {
    .el-icon-s-tools {
      color: #67C23A;
      animation: iconFloat 3s ease-in-out infinite 0.5s;
    }
  }
  
  @keyframes iconFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
  }
  
  .inspiration-section {
    background: rgba(255,255,255,0.9);
    border-radius: 15px;
    padding: 2rem;
    margin: 0 auto;
    max-width: 800px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
  }
  
  .quote-title {
    color: #2c3e50;
    margin-bottom: 1.5rem;
  }
  
  .animated-quote {
    font-size: 1.1rem;
    line-height: 2;
    color: #606266;
    
    .highlight {
      color: #E6A23C;
      font-weight: 500;
      position: relative;
      
      &::after {
        content: '';
        position: absolute;
        bottom: -2px;
        left: 0;
        width: 100%;
        height: 2px;
        background: currentColor;
        animation: underline 2s infinite;
      }
    }
    
    .gradient-text {
      background: linear-gradient(45deg, #409EFF, #67C23A);
      background-clip: text;
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      font-weight: bold;
    }
    
    .code-style {
      font-family: monospace;
      background: rgba(0,0,0,0.05);
      padding: 0.2em 0.4em;
      border-radius: 4px;
    }
    
    .algorithm-style {
      font-style: italic;
      color: #F56C6C;
    }
  }
  
  @keyframes underline {
    0%, 100% { width: 0 }
    50% { width: 100% }
  }
  
  .card-enter-active {
    transition: all 0.5s ease;
  }
  .card-enter-from {
    opacity: 0;
    transform: translateY(30px);
  }
  
  @media (max-width: 768px) {
  .content-wrapper {
    padding: 1rem;
  }

  .card-group {
    flex-direction: column;
    gap: 1.5rem;
    padding: 0 1rem;
  }

  .identity-card {
    width: 100% !important;
    height: 180px;
    margin: 0 auto;

    .card-content {
      padding: 1.5rem;
      
      i {
        font-size: 2.5rem;
      }

      h2 {
        font-size: 1.5rem;
      }

      .sub-text {
        font-size: 0.9rem;
      }
    }
  }

  .inspiration-section {
    padding: 1.5rem;
    margin: 0 1rem;
    
    .quote-title {
      font-size: 1.1rem;
    }

    .animated-quote {
      font-size: 0.95rem;
      line-height: 1.8;
      
      .code-style {
        font-size: 0.85rem;
      }
    }
  }

  /* 优化移动端hover效果 */
  .identity-card {
    transform: none !important;
    &:active {
      transform: scale(0.98) !important;
    }
  }

  /* 调整背景动画速度 */
  .animated-background {
    animation-duration: 30s;
    background-size: 40px 40px;
  }
}

@media (max-width: 480px) {
  .card-content {
    padding: 1rem !important;
    
    i {
      margin-bottom: 0.5rem !important;
    }

    h2 {
      margin-bottom: 0.3rem !important;
    }
  }

  .inspiration-section {
    padding: 1rem !important;
    
    .animated-quote {
      font-size: 0.9rem !important;
      line-height: 1.6;
    }
  }
}

/* 添加移动端专属动画 */
@keyframes mobile-scale {
  0% { transform: scale(1); }
  50% { transform: scale(0.98); }
  100% { transform: scale(1); }
}

@media (hover: none) {
  .identity-card {
    animation: mobile-scale 6s ease-in-out infinite;
  }
}
  </style>